package ooday04;

import java.util.Timer;
import java.util.TimerTask;

/**
 * 匿名内部类的练习，定时器
 */
public class TimerDemo {
    public static void main(String[] args) {
        Timer timer = new Timer();
        timer.schedule(new TimerTask() {
            int i = 1;

            @Override
            public void run() {

                System.out.println("第" + i + "次");
                i++;
            }
        }, 1000, 1000);
    }
}
